import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  envDir: './src',
  resolve: {
    alias: {
      "@": path.resolve("./src")
    }
  },
  //scss全局变量一个配置
  css: {
      preprocessorOptions: {
        scss: {
          javascriptEnabled: true,
          additionalData: '@import "./src/styles/variable.scss";',
        },
      },
    },
  server: {
    port: 62841,
    proxy: {
      '/api': {
        target: 'http://120.46.211.11:8099', // 目标后端API地址
        changeOrigin: true,              // 是否改变源地址
        rewrite: (path) => path.replace(/^\/api/, ''), // 重写路径
      },
    },
  }
})
